package com.jiukuaidao.zhulin.api;


import com.jiukuaidao.library.net.RootResult;
import com.jiukuaidao.zhulin.comm.Constant;
import com.jiukuaidao.zhulin.entity.ApiAppKey;
import com.jiukuaidao.zhulin.entity.ApiCityListInfo;
import com.jiukuaidao.zhulin.entity.ApiConfirmOrderInfo;
import com.jiukuaidao.zhulin.entity.ApiFilePost;
import com.jiukuaidao.zhulin.entity.ApiGeoCoderInfo;
import com.jiukuaidao.zhulin.entity.ApiGoodsCommentsInfo;
import com.jiukuaidao.zhulin.entity.ApiGoosDetailInfo;
import com.jiukuaidao.zhulin.entity.ApiHistoryAddressInfo;
import com.jiukuaidao.zhulin.entity.ApiHomeAds;
import com.jiukuaidao.zhulin.entity.ApiHomePros;
import com.jiukuaidao.zhulin.entity.ApiOrderCommentPost;
import com.jiukuaidao.zhulin.entity.ApiOrderDetailInfo;
import com.jiukuaidao.zhulin.entity.ApiOrderList;
import com.jiukuaidao.zhulin.entity.ApiPoiSearchInfo;
import com.jiukuaidao.zhulin.entity.ApiShoppingCartInfo;
import com.jiukuaidao.zhulin.entity.ApiSortCatList;
import com.jiukuaidao.zhulin.entity.ApiSortPros;
import com.jiukuaidao.zhulin.entity.ApiUserInfo;
import com.jiukuaidao.zhulin.module.order.PostOrderInfo;
import com.jiukuaidao.zhulin.module.pay.wechat.util.PayResult;
import com.jiukuaidao.zhulin.module.shoppingcart.AddGoodsParamsInfo;

import java.util.Map;

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

/**
 * Author : H_Joker
 * Date : 2016/5/12
 * Description : API访问方法接口（retrofit）
 */
public interface ApiManager {

    @GET("user/0")
    Call<RootResult<ApiAppKey>> getMethod(@QueryMap Map<String, String> filters);

    @POST("jkd1/sys_user/userTest.htm")
    @FormUrlEncoded
    Call<RootResult<ApiAppKey>> postMethod(@FieldMap Map<String, String> filters);

    @Multipart
    @POST("pictures/upload.htm")
    Call<RootResult<ApiFilePost>> postFiles(@PartMap Map<String, RequestBody> params);

    // 登录
    @POST(Constant.USER_LOGIN)
    Call<RootResult> getLogin(@Body Map<String, String> filters);

    //手机号快捷登录
    @POST(Constant.LOGIN_QUICK)
    Call<RootResult> getMobileBind(@Body Map<String, String> filters);

    // 用户注册
    @POST(Constant.USER_REGISTER)
    Call<RootResult<ApiUserInfo>> getRegister(@Body Map<String, String> filters);

    // 设置密码
    @PUT(Constant.PASSWORD_SET)
    Call<RootResult> getSetPwd(@Body Map<String, String> filters);

    //确认找回密码
    @PUT(Constant.PASSWORD_FIND_GETBACK)
    Call<RootResult> getBack(@Body Map<String, String> filters);

    // 保存密码
    @PUT(Constant.PASSWORD_FIND)
    Call<RootResult> getSavePwd(@Body Map<String, String> filters);

    //修改密码
    @PUT(Constant.PASSWORD_UPDATE)
    Call<RootResult> getUpdatePwd(@Body Map<String, String> filters);

    //刷新用户信息
    @GET(Constant.USER_INFO_REFRESH)
    Call<RootResult<ApiUserInfo>> getUserInfo(@QueryMap Map<String, String> filters);

    // 获取验证码
    @GET(Constant.PHONE_CODE)
    Call<RootResult> getCode(@QueryMap Map<String, String> filters);

    // 获取图形验证码
    @GET(Constant.GRAPHIC_CODE)
    Call<ResponseBody> getGraphicCode(@QueryMap Map<String, String> filters);

    //验证图形码
    @GET(Constant.VALIDATE_GRAPHIC)
    Call<RootResult> getValidateGraphic(@QueryMap Map<String, String> filters);


    //收货地址列表
    @GET(Constant.ADDRESS_LIST)
    Call<RootResult<ApiHistoryAddressInfo>> getAddressInfo(@QueryMap Map<String, String> filters);

    //新增、编辑地址
    @POST(Constant.ADD_ADDRESS)
    Call<RootResult<ApiHistoryAddressInfo.AddressInfo>> getAddAddress(@Body Map<String, String> filters);

    //删除收货地址
    @DELETE(Constant.DEL_ADDRESS + "/{addressId}")
    Call<RootResult> deleteAddress(@Path("addressId") String addressId);

    @GET(Constant.BAIDU_POI_SEARCH)
    Call<ApiPoiSearchInfo> poiSearch(@QueryMap Map<String, Object> params);

    @GET(Constant.BAIDU_GEOCODING)
    Call<ApiGeoCoderInfo> geocoding(@QueryMap Map<String, String> params);

    // 首页banner和运营位
    @GET(Constant.HOME_ACTANDADS)
    Call<RootResult<ApiHomeAds>> getHomeAds(@QueryMap Map<String, String> filters);

    // 首页商品列表
    @GET(Constant.HOME_PROLIST)
    Call<RootResult<ApiHomePros>> getHomePros(@QueryMap Map<String, String> filters);

    //订单列表
    @GET(Constant.ORDER_LIST + "/{status}" + "/{pageIndex}")
    Call<RootResult<ApiOrderList>> getOrderList(@Path("status") String status, @Path("pageIndex") String pageIndex);

    // 分类页获取分类
    @GET(Constant.SORT_CATEGORY)
    Call<RootResult<ApiSortCatList>> getSortCat(@QueryMap Map<String, String> filters);

    // 分类页获取商品列表
    @GET(Constant.SORT_PROLIST)
    Call<RootResult<ApiSortPros>> getSortPros(@QueryMap Map<String, String> filters);

    //订单详情
    @GET(Constant.ORDER_DETAIL + "/{orderNo}")
    Call<RootResult<ApiOrderDetailInfo>> getOrderDetail(@Path("orderNo") String orderNumber);

    // 确认支付
    @GET(Constant.CONFIRM_PAY + "/{orderNumber}")
    Call<RootResult<PayResult>> getConfirmPay(@Path("orderNumber") String orderId);

    //支付完成调用接口
    @PUT(Constant.ORDER_FINISH_PAY)
    Call<RootResult> getOrderFinishPay(@Body Map<String, String> filters);

    //确认订单
    @POST(Constant.CONFIRM_ORDER)
    Call<RootResult<ApiConfirmOrderInfo>> getConfirmOrder(@Body PostOrderInfo info);

    //商品详情
    @GET(Constant.GOODS_DETAIL)
    Call<RootResult<ApiGoosDetailInfo>> getGoodsDetail(@QueryMap Map<String, String> filters);

    @GET(Constant.GOODS_COMMENTS)
    Call<RootResult<ApiGoodsCommentsInfo>> getGoodsComments(@QueryMap Map<String,String> filters);

    //取消订单
    @PUT(Constant.ORDER_CANCEL)
    Call<RootResult<String>> getOrderCancel(@Body Map<String, String> filters);

//    //添加购物车
//    @POST(Constant.ADD_SHOPPINGCART)
//    Call<RootResult> getAddShoppingCart(@Body Map<String, String> filters);

//    //修改商品
//    @PUT(Constant.REDUCE_SHOPPINGCART)
//    Call<RootResult<String>> deleteRecudeShoppingCart(@Path("pack") String pack,
//                                                      @Path("gn") String gn,
//                                                      @Body int count);

    //订单签收
    @PUT(Constant.ORDER_RECEIPT )
    Call<RootResult<String>> getOrderReceipt(@Body Map<String, String> filters);

    //订单投诉
    @POST(Constant.ORDER_COMPLAINT)
    Call<RootResult<Object>> getOrderComplaint(@Body Map<String, String> filters);

    //购物车数据
    @POST(Constant.SHOPPINGCART)
    Call<RootResult<ApiShoppingCartInfo>> getShoppingCart(@Body AddGoodsParamsInfo info);

    //城市列表
    @GET(Constant.CITY_LIST)
    Call<RootResult<ApiCityListInfo>> getCityList(@QueryMap Map<String, String> filters);

    //提交订单
    @POST(Constant.ORDER_OPINION)
    Call<RootResult<Object>> postOrderComment(@Body ApiOrderCommentPost info);


}
